#!/usr/bin/python
# -*- coding: utf-8 -*-

from class_document import *
import sys
import tool_tree as tt
import os

sys.path.append('./rstr_max/')
from tools_karkkainen_sanders import *
from rstr_max import *

path = sys.argv[1]
d = Document(path)
f = d.forest
p = d.list_paragraph
t = d.title
s = d.list_sections
c = d.list_carac

print d
1/0



#h = d.list_hr

g = get_tgt_granularity(d)
print g

print c
old_s = OLD_get_sections(c)
print old_s
print len(s)

print t
for sec in s :
  print sec

for i,carac in enumerate(c) :
  print i,h[i],carac,p[i][:40].encode('utf-8')

#print '│'
#print '└'

#list_section = []
#list_sec = []
#for (id_start, id_end) in s :
#  len_sec = id_end - id_start + 1
#  sec = Section(id_start, len_sec, p, c)
#  print sec


#  print id_start, id_end
#  sublist_par = p[id_start:id_end+1]
#  sublist_car = c[id_start:id_end+1]
#  print len(sublist_par)
#  for par in sublist_par :
#    print par
#  print sublist_par
#  for p in sublist_par :
#    print p

#print s
#print c
#for i,par in enumerate(p) :
#  print c[i], h[i], par[:50]

#print s
#print c

